package com.gitee.form_token.common;

import cn.hutool.json.JSONUtil;
import lombok.Data;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@Data
public class RespUtil {

    public static void writer(HttpServletResponse response, Result result) throws IOException {
        response.setContentType("application/json;charset=UTF-8");
        PrintWriter writer = response.getWriter();

        String jsonStr = JSONUtil.toJsonStr(result);
        writer.println(jsonStr);
    }

}
